home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / mus / misc / NSM_iset.lha / iset / iset.c < prev    next >
C/C++ Source or Header  |  1999-02-26  |  2KB  |  72 lines

  1. /*
  2.     Lets you specify the midichannel,
  3.     midipreset and volume on the current
  4.     instrument without using the mouse.
  5.  
  6.     Made by Kjetil S. Matheussen 26.2.99.
  7.  
  8.     e-mail: kjetilma@ifi.uio.no
  9.  
  10.     Address:
  11.     Kjetil S. Matheussen
  12.     5423 Sogn Studentby
  13.     0858 Oslo
  14.     Norway
  15. */
  16.  
  17. #include <string.h>
  18. #include "/nsm.h"
  19. #include "/readstr.h"
  20.  
  21. void main(){
  22.     OCTABASE ob;
  23.  
  24.     UWORD instrument;
  25.     int channel,preset,volume;
  26.  
  27.     char *dosbase,*filehandle;
  28.     char string[80];
  29.  
  30.     if((ob=getoctabase())==0) goto exit;            /* Allways include this line first in
  31.                                                                     your plug-ins. */
  32.  
  33.     dosbase=opendoslibrary();
  34.     filehandle=openoctacon(dosbase,450,70);
  35.  
  36.     instrument=getcurrinstrument(ob);
  37.  
  38.     sprintf(string,"Channel: %d - Preset: %d - Volume: $%x\n",getmidichannel(ob,instrument),getmidipreset(ob,instrument),getvolume(ob,instrument));
  39.     writestring(dosbase,filehandle,string,strlen(string));
  40.  
  41.     writestring(dosbase,filehandle,"New Channel: ",14);
  42.     readstring(dosbase,filehandle,string,70);
  43.     if(*string!=0){
  44.         sscanf(string,"%d",&channel);
  45.         if(channel>=0 && channel<17)
  46.             sendrexxword("IN_SETMIDICHANNEL ",channel,"");
  47.     }
  48.  
  49.     writestring(dosbase,filehandle,"New Preset: ",12);
  50.     readstring(dosbase,filehandle,string,70);
  51.     if(*string!=0){
  52.         sscanf(string,"%d",&preset);
  53.         if(preset>=0 && preset<=2800)
  54.             sendrexxword("IN_SETMIDIPRESET ",preset,"");
  55.     }
  56.  
  57.     writestring(dosbase,filehandle,"New Volume: $",14);
  58.     readstring(dosbase,filehandle,string,70);
  59.     if(*string!=0){
  60.         sscanf(string,"%x",&volume);
  61.         if(volume>=0 && volume<=0x40)
  62.             sendrexxword("IN_SETVOLUME ",volume,"");
  63.     }
  64.  
  65.  
  66. close:
  67.     closefile(dosbase,filehandle);
  68.     closedoslibrary(dosbase);
  69.  
  70. exit:
  71. }
  72.